﻿
// file meeting_video_interface.h
// brief screen share of Meeting Service Interface

#ifndef WEMEET_MEETING_VIDEO_FRAME_INTERFACE_H_
#define WEMEET_MEETING_VIDEO_FRAME_INTERFACE_H_
#include <cstdint>

enum VideoFormat {
  kVideoFormatNone = 0, // No error
  kVideoFormatI420 = 1, // engine Init failed
  kVideoFormatRGB24= 2, // AV error
  kVideoFormatRGBA = 3, // Internal error
  kVideoFormatARGB = 4, // Not support this feature now
  kVideoFormatUnknown = 99, // Unknown
};
// brief: video callback of IMeetingVideoController
// OnVideoComplete : callback of EnableVideo API
// OnVideoComplete : callback of RquestVideo API
typedef struct tagMeetingVideoFrame {
  uint32_t size;
  uint8_t* data;
  uint32_t format;
  uint32_t width;
  uint32_t height;
  uint32_t rotate;
  uint64_t uin;
  const char* stream;

tagMeetingVideoFrame(uint32_t frame_size, uint8_t* frame_data, uint32_t frame_format, uint32_t frame_width, uint32_t frame_height, uint32_t frame_rotate, uint64_t frame_uin, const char* frame_stream)
  : size(frame_size)
  , data(frame_data)
  , format(frame_format)
  , width(frame_width)
  , height(frame_height)
  , rotate(frame_rotate)
  , uin(frame_uin)
  , stream(frame_stream) {
  }
} MeetingVideoFrame;

typedef struct tagMeetingVideoLayer {
  uint32_t index;
  uint32_t size;
  uint8_t* data;
  uint32_t format;
  uint32_t blend_mode;
  double left;
  double top;
  uint32_t width;
  uint32_t height;
  uint32_t container_width;
  uint32_t container_height;
  uint64_t uin;
  bool visible;
  const char* stream;

  tagMeetingVideoLayer(uint32_t layer_index, uint32_t layer_size, uint8_t* layer_data, uint32_t layer_format, uint32_t layer_blend_mode,
                        double layer_left, double layer_top, uint32_t layer_width, uint32_t layer_height, uint32_t layer_container_width, uint32_t layer_container_height,
                        uint64_t layer_uin, bool layer_visible, const char* layer_stream)
    : index(layer_index)
    , size(layer_size)
    , data(layer_data)
    , format(layer_format)
    , blend_mode(layer_blend_mode)
    , left(layer_left)
    , top(layer_top)
    , width(layer_width)
    , height(layer_height)
    , container_width(layer_container_width)
    , container_height(layer_container_height)
    , uin(layer_uin)
    , visible(layer_visible)
    , stream(layer_stream) {
  }
} MeetingVideoLayer;

class IMeetingVideoFrameCtrlDelegate {
public:
  virtual void OnVideoFrame(const tagMeetingVideoFrame& frame) = 0;
};

// brief: Meeting video controller interface
class IMeetingVideoFrameController {
public:
  virtual int SetDelegate(IMeetingVideoFrameCtrlDelegate *delegate) = 0;
};
#endif
